/**
 * 一定要在加载html前添加这个ui.registeH5Function('readResString', readResString)
 */
BrowseVueLoader.rewriteHttpUtilsCore((url) => {
    return new Promise((resolve) => {
        const testData = window.ec.call('readResString', url);
        resolve(testData)
    })
})

/**
 *     ui.registeH5Function('toBase64Format', (objJson) => {
 *         let obj = JSON.parse(objJson)
 *         let base64Format = image.toBase64Format(readResAutoImage(obj.url), obj.type, 100);
 *         base64Format = 'data:image/' + obj.type + ';base64,' + base64Format
 *         return base64Format
 *     })
 */
BrowseVueLoader.rewriteReplaceUrl((newUrl, baseUrl, oldUrl) => {
    let returnDirectly = ['.vue', '.js']
    for (let string of returnDirectly) {
        if (newUrl.endsWith(string)) {
            return newUrl
        }
    }
    // format 格式，jpg或者png
    let img2Base64 = ['.png', '.jpg']
    for (let string of img2Base64) {
        if (newUrl.endsWith(string)) {
            return window.ec.call('toBase64Format', JSON.stringify({
                url: newUrl,
                type: string.substring(1)
            }));
        }
    }
    return newUrl
})












